package com.qfedu.common.core.enums;

/**
 * @Classname CouponTypeEnum
 * @Description TODO
 * @Date 2025-09-25 10:07
 * @Created by 老任与码
 */
public enum CouponTypeEnum {

    FULL_DISCOUNT(1, "满减券"),
    INSTANT_DISCOUNT(2, "立减券"),
    DISCOUNT(3, "折扣券");

    private int type;
    private String desc;

    public int getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    CouponTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    /**
     * 根据类型的值得到枚举值
     *
     * @param type
     * @return
     */
    public static CouponTypeEnum getCouponTypeEnum(int type) {
        CouponTypeEnum[] values = CouponTypeEnum.values();
        for (CouponTypeEnum value : values) {
            if (value.getType() == type) {
                return value;
            }
        }
        return null;
    }
}
